home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- organization: APT Technology, Inc. San Jose, CA, USA
- subject: v10i024: roff version 1.7
- from: brian@apt.UUCP (Brian Litzinger)
- Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 10, Issue 24
- Submitted-by: brian@apt.UUCP (Brian Litzinger)
- Archive-name: roff17
-
- [??? ++bsa]
-
- Yet another absolutely useless program. Just /bin/rm roff.shar
- and you live a much better life.
-
- Maybe we should get a new moderator for this group. 8-)
-
- This is an improved version of the roff script I wrote. It has
- been enhanced by contributions from roff users. (As hard as it
- may be to believe someone actually found code by me useful)
-
- roff, if you care, lets you encode the filters that a troff file
- must be passed through to be printed into the file itself. Thus
- you won't have to remember if the document requires pic, or tbl,
- or pic and tbl and grap, and so on.
-
- <> Brian Litzinger @ APT Technology Inc., San Jose, CA
- <> UUCP: {apple,sun,pyramid}!daver!apt!brian brian@apt.UUCP
- <> VOICE: 408 370 9077 FAX: 408 370 9291
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of shell archive."
- # Contents: README roff
- # Wrapped by brian@apt on Wed Jan 17 00:29:45 1990
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README'\"
- else
- echo shar: Extracting \"'README'\" \(2007 characters\)
- sed "s/^X//" >'README' <<'END_OF_FILE'
- XThis is version 1.7 of roff.
- X
- XIt incorporates some new features that were contributed by other
- Xuser's of roff.
- X
- Xroff is a script that allows you to encode the filters that a troff
- Xfile must be passed through along with which macro packages to use
- Xin the document file.
- X
- XTo use roff you simply add a roff command line as the first line of
- Xyour document file. Then when you wish to print out the document
- Xyou can simply enter
- X
- X roff filename
- X
- Xroff will generate the correct command stream to print the file.
- X
- Xthe roff command line is basically a line of text that is passed to
- Xeval(1). Its format is as follows:
- X
- X.\" exec tbl | pic | eroff -mm
- X
- Xthe '.\"' is a troff/nroff comment delimeter. The 'exec' helps identify
- Xthis line as a roff command line.
- X
- Xthe rest of the line is the filters, packages, and macros that the
- Xdocument file should be passed through. Other examples are:
- X
- X.\" exec eroff
- X
- X.\" exec tbl | eroff -mm -mapt
- X
- XIf you look at the roff script you will notice that we strip off the
- Xfirst line of the document file (the roff command line) before we
- Xpipe the document through the rest of the filters. This is due to
- Xa previous bout of ignorance on the part of the author, and must now
- Xremain with us forever to maintain compatibility with older roff command
- Xlines.
- X
- XYou might also notice a reference to '$F'. This is necessary for us
- Xto be compatible with another older roff command line format.
- X
- XIf you are a user of the previous version of roff the following
- Xenhancements have been added:
- X
- X1. the roff command line of the previous version relied on characters
- Xbeing in particular locations. I.E. exec had to occur as the forth
- Xcharacter of the roff line. This requirement is gone, as the new
- Xroff treats the entries as fields seperated by arbitrary amounts
- Xof white space.
- X
- X2. #!/bin/sh was added to the beginning for csh users.
- X
- X3. roff now takes the '-p' argument to pass the file to other troff
- Xprocessors such as psroff.
- X
- Xbugs:
- X
- X I sure wish roff could take input from stdin.
- END_OF_FILE
- if test 2007 -ne `wc -c <'README'`; then
- echo shar: \"'README'\" unpacked with wrong size!
- fi
- # end of 'README'
- fi
- if test -f 'roff' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'roff'\"
- else
- echo shar: Extracting \"'roff'\" \(1163 characters\)
- sed "s/^X//" >'roff' <<'END_OF_FILE'
- X#!/bin/sh
- X# roff by Brian E. Litzinger
- X# $Header: roff,v 1.7 90/01/17 00:19:18 brian Exp $
- X# Contributing Authors:
- X# Jeff Goldstein, Svante Lindahl, Barry Schwartz
- X#
- X# Usage: roff [ -p prefix ] [ options ] file-name ...
- X# The troff-prefix is the first part of the troff command name, the
- X# second part being "roff". For example, type
- X# roff -f ps file
- X# to run the file through psroff and the appropriate filters and macros.
- X
- XTROFF=eroff
- XPREFIX=e
- XTMP=/tmp/roff$$
- Xif [ $# -lt 1 ] ; then
- X echo "Usage: `basename $0` [ -p prefix ] [options] files"
- X exit 2
- Xfi
- Xwhile [ -n "$1" ] ; do
- X case "$1" in
- X -p)
- X shift
- X PREFIX=$1
- X ;;
- X -*)
- X args="$args $1"
- X ;;
- X *)
- X command_line="`sed -e 1q $1`"
- X b="`echo $command_line | cut -f2 -d' '`"
- X if [ "$b" != "exec" ] ; then
- X echo "$1 not roff format file!"
- X exit 2
- X fi
- X command="`echo $command_line | cut -f3- -d' '"
- X d="sed -e 1d $1 |"
- X for i in $command ; do
- X if [ "$i" = '$F' ] ; then
- X true
- X else
- X if [ "$i" = "$TROFF" ] ; then
- X d="$d ${PREFIX}roff $args"
- X else
- X d="$d $i"
- X fi
- X fi
- X done
- X #echo $d
- X eval $d
- X ;;
- X esac
- X shift
- Xdone
- END_OF_FILE
- if test 1163 -ne `wc -c <'roff'`; then
- echo shar: \"'roff'\" unpacked with wrong size!
- fi
- chmod +x 'roff'
- # end of 'roff'
- fi
- echo shar: End of shell archive.
- exit 0
-
-